@import '../../theme.scss';
@import '../../mixin.scss';

$panelHeight: calc(100% - 85px);

/* 数据详情 */
.detail {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  right: 0;
  bottom: 0;

  &.vertical {
    top: 50%;
    left: 0;
    right: 0;
    bottom: 0;

    &.open .content {
      width: 100vw;
    }
  }

  &.open {
    display: block;
    .content {
      width: 50vw;
      min-width: 500px;
    }
    .mask {
      display: block;
      cursor: pointer;
    }
  }

  .detailTop {
    display: flex;
    align-items: center;

    .icon-close {
      margin-left: 15px;
      cursor: pointer;
      fill: rgb(241, 196, 15);
      &:hover {
        fill: rgb(203, 67, 53);
      }
    }
  }
  .content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    transition: all 0.25s ease-in-out;
    background-color: $boxColor;
    color: #fff;

    .url {
      background-color: $boxColor;
      color: $linkColor;
      height: 40px;
      line-height: 40px;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      padding: 0 10px;
      cursor: pointer;
      font-size: 15px;
      &:hover {
        text-decoration: underline;
        color: $hoverColor;
      }
    }

    .tabs {
      display: flex;
      align-items: center;
      background-color: $detailTabsBackground;
      // box-shadow: $detailTabsBackground 0px 10px 10px -10px;
      margin: 0 10px;
    }

    .tabs > ul {
      display: flex;
      flex: 1;
      align-items: center;
      justify-content: space-evenly;
      margin-bottom: 0;

      li {
        text-align: center;
        cursor: pointer;
        font-weight: bold;
        font-size: 16px;
        align-items: center;
        justify-content: center;
        color: #999;
        height: 30px;
        line-height: 30px;
        flex: 1;

        &:hover {
          color: rgb(46, 204, 113);
        }
        &.active {
          color: rgb(231, 76, 60);
          background-repeat: repeat;
          background-image: linear-gradient(to bottom, rgb(20, 20, 20), rgb(23, 32, 42));
          // background-image: linear-gradient(to bottom, rgb(20, 20, 20), rgb(255, 0, 42));
        }
      }
    }

    .form {
      table.kv-table {
        width: 100%;
        font-size: 17px;
        border-collapse: collapse;
        .bproxy-key {
          color: rgb(175, 122, 197);
          background: #000;
          padding: 5px;
          border-radius: 5px;
        }
        tr {
          td {
            border: solid 1px rgb(133, 146, 158, 0.1);
            &:nth-child(1) {
              text-align: right;
              // color: $labelKeyColor;
              color: rgb(210, 180, 222);
              width: 40%;
              &.hl {
                color: red;
                font-weight: bold;
              }
            }
            &:nth-child(2) {
              color: $labelValueColor;
              padding-left: 5px;
              > span {
                cursor: pointer;
              }
              &:hover {
                color: $hoverColor;
              }
            }
          }
        }
      }

      &.json {
        &::before {
          content: '数据格式：json';
          width: 100%;
          height: 30px;
          color: #fff;
          background: #141414;
          text-align: center;
          line-height: 30px;
          display: flex;
          align-items: center;
          justify-content: center;
          padding: 4px 0;
          border-radius: 3px;
          margin-bottom: 10px;
          font-size: 16px;
        }
      }
      &.formData {
        &::before {
          content: '数据格式：formData';
          color: #fff;
          background: #566573;
          display: flex;
          align-items: center;
          justify-content: center;
          padding: 5px 0;
          border-radius: 3px;
          margin-bottom: 10px;
        }
      }
    }
  }

  .response-viewer {
    tab-size: 2;
    word-spacing: 0;
    line-height: 1.3;

    .tips {
      color: #555;
    }
  }

  .max-text-limit {
    max-width: 500px;
    display: inline-block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.3;
  }
  .max-text-limit-2 {
    max-width: 300px;
    display: inline-block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.3;
  }

  .react-json-view {
    background: none !important;
  }
}

.data-table {
  width: 100%;
  margin-top: 5px;
  border-collapse: collapse;
  font-size: 13px;
  caption {
    border: solid 1px #2e4053;
    padding: 5px 0;
    text-align: center;
    background: #2e4053;
    color: #fff;
    caption-side: top;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
  }
  thead {
    margin-top: 40px;
  }
  td {
    border: solid 1px #2e4053;
    padding: 3px 20px;
    word-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap;
    &:nth-child(1) {
      font-weight: bold;
      color: #aaa;
    }
    &:nth-child(2) {
      color: #999;
      > span {
        cursor: pointer;
      }
    }
  }
}

.body-panel {
  margin: 0 10px;
  position: relative;
  height: $panelHeight;
  word-wrap: break-word;
  word-break: break-all;
  white-space: pre-wrap;
  background-color: $detailContentBackground;
  color: #aaa;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1;
  // margin-top: 3px;
  // border-radius: 0 0 5px 5px;

  .not-support {
    text-align: center;
  }
  .image-preview-box {
    text-align: center;
    .ant-spin {
      display: block;
    }
  }
  .video-preview-box {
    video {
      width: 100%;
    }
  }
  .image-preview {
    max-width: 100%;
    max-height: 100%;
    box-shadow: rgb(255 255 255 / 25%) 0px 50px 100px -20px, rgb(0 0 0 / 30%) 0px 30px 60px -30px;
  }
  .handlers {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    .ant-btn {
      margin-left: 10px;
    }
  }
  pre {
    line-height: 1.3;
    font-size: 13px;
    a {
      color: rgb(39, 174, 96);
      .str {
        color: rgb(39, 174, 96);
      }
      &:hover {
        text-decoration: underline;
      }
    }
  }
  .ws-list {
    list-style: none;
    padding: 0;
    padding-right: 40px;
    li {
      padding: 5px;
      padding-top: 30px;
      margin-top: 10px;
      padding-left: 10px;
      color: rgb(165, 105, 189);
      background-color: #000;
      border-radius: 5px;
      position: relative;
      &::before {
        position: absolute;
        top: 0;
        left: 0;
        color: yellow;
        color: rgb(52, 152, 219);
        content: attr(data-time);
        margin-left: 10px;
      }
    }
  }
  .format-btn {
    display: inline-flex;
    align-items: center;
    padding: 3px 4px;
    background: chocolate;
    color: #fff;
    border-radius: 2px;
    margin-left: 10px;
    font-size: 11px;
  }
}

.raw-body {
  margin: 0 10px;
  box-sizing: border-box;
  position: relative;
  height: $panelHeight;
  word-wrap: break-word;
  word-break: break-all;
  white-space: pre-wrap;
  background-color: $cardColor;
  color: #fff;
  padding: 15px;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.3;
  .title {
    font-size: 20px;
    color: rgb(22, 160, 133);
  }
}

.params-view {
  .title {
    font-size: 13px;
    font-weight: bold;
    padding: 5px 10px;
    color: rgb(46, 204, 113);
    margin-top: 10px;
  }
  .form {
    height: auto;
    background-color: rgb(27, 38, 49);
    padding: 10px;
    &.empty {
      display: none;
    }
  }
  .emptyText {
    color: #666;
    padding-left: 20px;
  }
}

.body-panel {
  pre {
    @include wordWrap();
  }
}
